package cn.achao.csr.log.service;

import cn.achao.csr.api.SysOperationLogApi;
import cn.achao.csr.api.model.dto.OperaAddDTO;
import cn.achao.csr.base.constant.SecurityConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 异步调用日志服务
 *
 * @author achao
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AsyncLogService {

    private final SysOperationLogApi remoteLogService;

    /**
     * 保存系统日志记录
     */
    @Async
    public void saveSysLog(OperaAddDTO req) {
        remoteLogService.add(req, SecurityConstants.INNER);
    }

}
